package com.systemframework.common;



import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.systemframework.util.Result;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * @author summer
 * @date 2023-03-20 14:22
 */

public interface BaseCommonInterface<E,V> {

    /**
     * 保存
     * @param e
     * @return
     */
    @PostMapping(value = "/save")
    Result<String> save(@Valid @RequestBody E e);

    /**
     * 更新
     * @param e
     * @return
     */
    @PutMapping(value = "/update")
    Result<String> update(@Valid @RequestBody E e);

    /**
     * 删除
     * @param id
     * @return
     */
    @GetMapping(value = "/del/{id}")
    Result<String> del(@PathVariable Integer id);


    /**
     * 查询列表
     * @param e
     * @return
     */
    @PostMapping(value = "/lists")
    Result<Page<V>>  lists(@RequestBody E e);


    /**
     * 根据id查询
     * @param id
     * @return
     */
    @GetMapping(value = "/findById/{id}")
    Result<V> findById(@PathVariable Integer id);


    /**
     * 批量删除
     * @param lists
     * @return
     */
    @PostMapping(value = "/batchDel")
    Result<String> batchDel(@RequestBody List<V>  lists);
}
